<?php


namespace app\api\controller\v16;


use app\api\controller\v13\Auth2;
use app\common\cachemodel\GoddessBaseInfo;
use app\common\model\Article as ArticleModel;
use think\response\Json;

/**
 * 星文列表
 * @version 2.0.0
 * Class Article
 * @package app\api\controller\v16
 */
class Article extends Auth2
{
    /**
     * @title 获取文章列表
     * @method GET
     * @return array|Json
     * @throws \Exception
     */
    public function index()
    {
        $page = input('page/d', 1);
        $map = [
            'page' => $page,
            'cid' => input('get.cid/d', 0),
            'uid' => $this->user['id'] ?? null,
            'uc_id' => $this->user['uc_id'],
        ];
        if ($map['cid'] < 1 || $map['page'] < 1)
        {
            return show(config('code.error'), '服务异常，请稍后再试');
        }

        $data = (new ArticleModel())->getArticleList($map, 2);
        return show(config('code.success'), '加载成功', $data);
    }
}
